﻿/*
对称串 
Time Limit:1000MS  Memory Limit:32768K


Description:
有一些字串，有些对称，有些不对称，请将对称的串按长度排列。

Sample Input:
123321
123454321
123
321
sdfsdfd
121212
\\dd\\
Sample Output:
123321
\\dd\\
123454321
*/
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <iterator>
#include <vector>
using namespace std;

int compare_by_length(const string& cs1, const string& cs2)
{
	return cs1.length()<cs2.length();
}
int main(int argc, char* argv[])
{
	vector<string> vs;
	vs.reserve(1024);
	{
		for (string s; cin>>s;)
		{
			string::size_type i=0, j=s.length()-1;
			for (; i<j; ++i, --j)
				if(s[i]!=s[j])
					break;
			if(i<j)
				continue;
			vs.push_back(s);
		}
	}
	if(vs.size())
	{
		sort(vs.begin(), vs.end(), compare_by_length);
		copy(vs.begin(), vs.end(), ostream_iterator<string>(cout, "\n"));
	}

	return EXIT_SUCCESS;
}
